<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" placeholder="数量">
<input type="text" value="狗1" onclick="f(1)">
<input type="text" value="狗2" onclick="f(2)">


<span></span>
<script>
function f(x) {
    let h = document.querySelector("input");
    for (let j= 0;j<h.value;j++){
    let g = x==1?"狗1.jpg":"狗2.jpg";
    let i = document.createElement("img");
    i.src = g;
    document.body.appendChild(i);
    }
}


</script>
</body>
</html>